package com.sense.kukoo.biz_library.model

import com.sense.kukoo.common.mvvm.model.BaseMvvmModel
import com.sense.kukoo.common.repo.bean.ResultBean
import com.sense.kukoo.common.repo.http.KukooHttpApi
import com.sense.kukoo.common.repo.http.KukooHttpManager
import com.sense.kukoo.common.repo.http.bean.IndexContentBean
import com.sense.kukoo.common.repo.http.bean.UserSearchBean

class LibraryModel: BaseMvvmModel() {

    private val TAG: String = javaClass.simpleName
    override fun onModelCleared() {}

    suspend fun followSearch(pageIndex: Int, pageSize: Int): ResultBean<List<IndexContentBean>> {
        return KukooHttpManager.instance
            .createHttpClient(KukooHttpApi::class.java)
            .followSearch("${pageIndex}", "${pageSize}")
    }

    suspend fun followListUser(): ResultBean<List<UserSearchBean>> {
        return KukooHttpManager.instance
            .createHttpClient(KukooHttpApi::class.java)
            .followListUser()
    }

    suspend fun getUserContent(
        pageIndex: Int,
        pageSize: Int,
        userId: Long,
    ): ResultBean<List<IndexContentBean>> {
        return KukooHttpManager.instance
            .createHttpClient(KukooHttpApi::class.java)
            .userSearchById("${pageIndex}", "${pageSize}", "${userId}")
    }

}